#proxy_eg
import urllib.request

url = 'http://icanhazip.com'

proxy_support = urllib.request.ProxyHandler({'http':'115.221.242.1:9999'})

#创建
opener = urllib.request.build_opener(proxy_support)
#opener.addheaders = [('User-Agent', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36')]
#安装
urllib.request.install_opener(opener)
#访问
response = urllib.request.urlopen(url)
#解码
html = response.read().decode('utf-8')
#打印
print(html)
